home *** CD-ROM | disk | FTP | other *** search
/ Gekkan Dennou Club 145 / Gekkan Dennou Club - 2000.6 Vol. 145 (Japan).7z / Gekkan Dennou Club - 2000.6 Vol. 145 (Japan) (Track 1).bin / games / spassion / source.lzh / SOURCE / FuncEnemy / VOLCANO.C < prev    next >
Text File  |  2000-03-26  |  4KB  |  164 lines

  1. /*
  2. #include <stdio.h>
  3. #include <iocslib.h>
  4. void    key_wait( void );
  5. #define BIT(i)        (1<<(i))
  6. */
  7. /*
  8. 火山
  9. */
  10. #include <xsp2lib.h>
  11. #include "../SPASSION.H"
  12. #include "../player.h"
  13. #include "../enemy.h"
  14. #include "../eshot.h"
  15. #include "../BG.H"
  16. #include "../effect.h"
  17. #include "../priority.h"
  18. #include "../sound.h"
  19. #include "../entry.h"
  20. #ifndef NULL
  21. #define NULL ((void *) 0)
  22. #endif
  23.  
  24. static short MoveEnemyVolcano( ENEMY *ene );
  25. /*static void TiniEnemyVolcano(ENEMY *);*/
  26. static short MoveEnemyRock(ENEMY *);
  27. /*static void TiniEnemyRock(ENEMY *);*/
  28.  
  29. #define PT_ST    0xD
  30. #define PT_END    0xF
  31.  
  32. static HIT_XY4    hit_p[]={-3-PLAYER_HIT_X,-3-PLAYER_HIT_Y,3+PLAYER_HIT_X,3+PLAYER_HIT_Y};
  33. static HIT_XY4    hit_o[]={-3-OPTION_HIT_X,-3-OPTION_HIT_Y,3+OPTION_HIT_X,3+OPTION_HIT_Y};
  34. static HIT_XY4    hit_s[]={-3,-3,3,3};
  35.  
  36. extern HIT_XY4    nohit;
  37.  
  38. static unsigned char seed=0;
  39.  
  40. void InitEnemyVolcanoHit( void )
  41. {
  42. }
  43. void InitEnemyRockHit( void )
  44. {
  45. }
  46.  
  47. void InitEnemyVolcano(ENEMY *ene)
  48. {
  49.     ene->vx             = -map_vx;
  50.     ene->vy             = 0;
  51.     ene->hit_p[0]     = NULL;
  52.     ene->hit_o[0]     = NULL;
  53.     ene->hit_s[0]     = NULL;
  54.     ene->no_dead     = 0;
  55.     ene->func_enemy_move = MoveEnemyVolcano;
  56. /*    ene->func_enemy_tini = TiniEnemyVolcano;*/
  57.  
  58. /*    entry_counter_stop = !0;*/        /* エントリーカウンター停止 */
  59. }
  60.  
  61. void InitEnemyRock(ENEMY *ene)
  62. {
  63.     short    pal[4]= {0x300,0x700,0x800,0x800};
  64.     short    info[4]={0x0,0x4000,0x8000,0xC000},p,i;
  65.     ene->vx = (rndtable[seed++] & 0x7) * (65536 / 4);
  66.     seed&=255;
  67.  
  68.     if( rndtable[seed++]>127 )
  69.         ene->vx *= -1;
  70.     seed&=255;
  71.     ene->vx -= map_vx;
  72.  
  73.     ene->vy = -(rndtable[seed++] & 0x7) * 32768;
  74.     seed&=255;
  75.  
  76.     if( !ene->vy )
  77.         ene->vy = -65536/4;
  78.  
  79.     p=pal[rndtable[seed++]&3];seed&=255;
  80.     i=info[rndtable[seed++]&3];seed&=255;
  81.     ene->info         = p | PRIORITY_ZAKO | i;
  82.     ene->hit_p[0]     = &hit_p[0];ene->hit_p[1]=NULL;
  83.     ene->hit_o[0]     = &hit_o[0];ene->hit_o[1]=NULL;
  84.     ene->hit_s[0]     = &hit_s[0];ene->hit_s[1]=NULL;
  85.     ene->hp             = 1;
  86.     ene->no_dead     = 0;
  87.     ene->func_enemy_move = MoveEnemyRock;
  88. /*    ene->func_enemy_tini = TiniEnemyRock;*/
  89.  
  90. /*    entry_counter_stop = !0;*/        /* エントリーカウンター停止 */
  91. }
  92.  
  93.  
  94. static short MoveEnemyVolcano( ENEMY *ene )
  95. {
  96.     /* 速度を足して上位ワード(固定整数部)だけ取り出す */
  97.     ene->x = ((ene->lx += ene->vx) >> 16);
  98.     ene->y = ((ene->ly += ene->vy) >> 16);
  99.  
  100.     if( rndtable[seed++]>164)
  101.         MakeEnemy(ENEMY_ROCK , ene->x  , ene->y, 0,  ene);
  102.     seed&=255;
  103.  
  104.     /* 画面外に出たら消去 */
  105.     if( ene->x < 16 - 32 )
  106.         return (0);
  107.  
  108.     return(1);
  109. }
  110.  
  111. static short MoveEnemyRock( ENEMY *ene )
  112. {
  113.     /* 速度を足して上位ワード(固定整数部)だけ取り出す */
  114.     ene->x = ((ene->lx += ene->vx) >> 16)-8;    /*-8は表示位置をずらすため*/
  115.     ene->y = ((ene->ly += ene->vy) >> 16)-8;
  116.  
  117.     ene->vy+=4096;
  118.     ene->pt = obj_obj+PT_ST+(ene->anim_count++)/8;
  119.     if( ene->pt > obj_obj+PT_END ){
  120.         ene->pt = obj_obj+PT_ST;
  121.         ene->anim_count=0;
  122.     }
  123. #if 0
  124.     if(ENE_X < 128){
  125.         ene->lx = 64*65536;
  126.         ene->ly = 192*65536;
  127.         ene->vx = 0;
  128.         ene->vy = 0;
  129.     }
  130.     if( BITSNS(0x04) & BIT(1) ){
  131.         while( BITSNS(0x04) & BIT(1) );
  132.         entry_counter_stop = 0;
  133.         return (0);
  134.     }
  135. #endif
  136.  
  137.     /* 画面外に出たら消去 */
  138.     if( ENE_X < 0 - 32 || ENE_X > 255 + 32 || ENE_Y > 255 + 32
  139.      || CheckBGHit(ENE_X-16,ENE_Y-16)!=NON_BG )
  140.         return (0);
  141.  
  142.     /* ダメージを受けた時の処理 */
  143. #if 1
  144.     if(ene->damage){
  145.         if((ene->hp -= ene->damage) <= 0) {
  146.             MakeEffect(EFFECT_EXPLMINI, 0, ene->x, ene->y);
  147.             ene->player->score += 1;
  148.             return (0);        /* 消去 */
  149.         }
  150.         ene->damage = 0;
  151.     }
  152. #endif
  153.  
  154.     xsp_set_st(ene);
  155.  
  156.     return(1);
  157. }
  158.  
  159. /*
  160. static void TiniEnemyRock(ENEMY * p)
  161. {
  162. }
  163. */
  164.